import ErrorDao from '../dao/ErrorDao.js'

export default (err, req, res, next) => {
  ErrorDao.save({
    errorName: err.name,
    errorMessage: err.message,
    errorStack: err.stack
  }).then(data => {
    res.json({
      status: 500,
      msg: '服务器内部错误',
      message: err.stack
    })
  })
}
